<?php
use Phalcon\Mvc\Router\Group as RouterGroup;
/* @var $router Phalcon\Mvc\Router*/
$router = $di->getRouter();

$router->setDefaultModule('frontend');
$router->setDefaultNamespace('app\\frontend\\controllers');
$router->add("/",[
    'module'=>'frontend',
    'namespace'=>'app\\frontend\\controllers',
    'controller'=>'site',
    'action'=>'login',
]);

$api = new RouterGroup([
    'module'=>'api',
]);

$api->setPrefix("/api");

$api->add("/:controller/",[
    'module'=>'api',
    'namespace'=>'app\\api\\controllers',
    'controller'=>1,
]);
$api->add("/:controller/:action/",[
    'module'=>'api',
    'namespace'=>'app\\api\\controllers',
    'controller'=>1,
    'action'=>2,
]);
//$router->setUriSource(\Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI);
$api->add("/:controller/:action/:params",[
    'module'=>'api',
    'namespace'=>'app\\api\\controllers',
    'controller'=>1,
    'action'=>2,
    'params'=>3,
]);
//$router->removeExtraSlashes(true);
// Define your routes here

$router->mount($api);

$router->handle();
